﻿Imports Microsoft.VisualBasic

Imports Microsoft.VisualStudio.TestTools.UnitTesting

Imports tiendaRegalos



'''<summary>
'''This is a test class for ProductoDAOTest and is intended
'''to contain all ProductoDAOTest Unit Tests
'''</summary>
<TestClass()> _
Public Class ProductoDAOTest


    Private testContextInstance As TestContext

    '''<summary>
    '''Gets or sets the test context which provides
    '''information about and functionality for the current test run.
    '''</summary>
    Public Property TestContext() As TestContext
        Get
            Return testContextInstance
        End Get
        Set(value As TestContext)
            testContextInstance = Value
        End Set
    End Property

#Region "Additional test attributes"
    '
    'You can use the following additional attributes as you write your tests:
    '
    'Use ClassInitialize to run code before running the first test in the class
    '<ClassInitialize()>  _
    'Public Shared Sub MyClassInitialize(ByVal testContext As TestContext)
    'End Sub
    '
    'Use ClassCleanup to run code after all tests in a class have run
    '<ClassCleanup()>  _
    'Public Shared Sub MyClassCleanup()
    'End Sub
    '
    'Use TestInitialize to run code before running each test
    '<TestInitialize()>  _
    'Public Sub MyTestInitialize()
    'End Sub
    '
    'Use TestCleanup to run code after each test has run
    '<TestCleanup()>  _
    'Public Sub MyTestCleanup()
    'End Sub
    '
#End Region


    '''<summary>
    '''A test for insertar
    '''</summary>
    <TestMethod()> _
    Public Sub insertarTest()
        'Dim target As ProductoDAO = New ProductoDAO() ' TODO: Initialize to an appropriate value
        'Dim modelo As Producto = Nothing ' TODO: Initialize to an appropriate value
        'Dim expected As Producto = Nothing ' TODO: Initialize to an appropriate value
        'Dim actual As Producto
        'actual = target.insertar(modelo)
        'Assert.AreEqual(expected, actual)
        'Assert.Inconclusive("Verify the correctness of this test method.")
        Dim negocio As New ProductoNegocio()

        Try
            Dim modelo = negocio.insertar("camara digital 15px", 2, 190, "D")

            Console.Write(modelo.idProducto)

            'Assert.AreEqual(13, modelo.idUsuario)

        Catch ex As DAOExcepcion
            Assert.Fail(ex.ToString())
        End Try
    End Sub

    '''<summary>
    '''A test for buscarPorNombre
    '''</summary>
    <TestMethod()> _
    Public Sub buscarPorNombreTest()
        'Dim target As ProductoDAO = New ProductoDAO() ' TODO: Initialize to an appropriate value
        ' nombre As String = String.Empty ' TODO: Initialize to an appropriate value
        'Dim expected As Collection = Nothing ' TODO: Initialize to an appropriate value
        ' Dim actual As Collection
        'actual = target.buscarPorNombre(nombre)
        'Assert.AreEqual(expected, actual)
        'Assert.Inconclusive("Verify the correctness of this test method.")
        Dim negocio = New ProductoNegocio

        Try

            Dim modelo = negocio.buscarPorNombre("digital")
            MsgBox(modelo.Count)
            '  Console.WriteLine(nombre)

        Catch ex As Exception
            Assert.Fail(ex.ToString())
        End Try

    End Sub
End Class
